package com.lzb.redis;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import org.junit.Test;

public class HongBao {
	//@Test
	public void testHonbao(){
		Calendar end = Calendar.getInstance();
		end.setTimeInMillis(144622080000L);
		System.out.println(new SimpleDateFormat("yyyyMMdd").format(end.getTime()));
		
		System.out.println(new Integer("1.0"));
	}
	
	@Test
	public void soft() throws Exception  
	{  
	    Object obj = new Object();  
	    ReferenceQueue<Object> refQueue = new ReferenceQueue<Object>();  
	    SoftReference<Object> softRef = new SoftReference<Object>(obj, refQueue);  
	    System.out.println(softRef.get()); // java.lang.Object@f9f9d8  
	    System.out.println(refQueue.poll());// null  
	  
	    // 清除强引用,触发GC  
	    obj = null;  
	    System.gc();  
	  
	    System.out.println(softRef.get());  
	  
	    Thread.sleep(200);  
	    System.out.println(refQueue.poll());  
	}  
}